home *** CD-ROM | disk | FTP | other *** search
/ Aminet 8 / Aminet 8 (1995)(GTI - Schatztruhe)[!][Oct 1995].iso / Aminet / dev / gcc / gcc270_src.lha / gcc-2.7.0-amiga / config / i386 / osfrose.h < prev    next >
C/C++ Source or Header  |  1995-06-15  |  32KB  |  926 lines

  1. /* Definitions of target machine for GNU compiler.
  2.    Intel 386 (OSF/1 with OSF/rose) version.
  3.    Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
  4.  
  5. This file is part of GNU CC.
  6.  
  7. GNU CC is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2, or (at your option)
  10. any later version.
  11.  
  12. GNU CC is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with GNU CC; see the file COPYING.  If not, write to
  19. the Free Software Foundation, 59 Temple Place - Suite 330,
  20. Boston, MA 02111-1307, USA.  */
  21.  
  22. #include "halfpic.h"
  23. #include "i386/gstabs.h"
  24.  
  25. /* Get perform_* macros to build libgcc.a.  */
  26. #include "i386/perform.h"
  27.  
  28. #define OSF_OS
  29.  
  30. #undef  WORD_SWITCH_TAKES_ARG
  31. #define WORD_SWITCH_TAKES_ARG(STR)                    \
  32.  (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) || !strcmp (STR, "pic-names"))
  33.  
  34. /* This defines which switch letters take arguments.  On svr4, most of
  35.    the normal cases (defined in gcc.c) apply, and we also have -h* and
  36.    -z* options (for the linker).  */
  37.  
  38. #define SWITCH_TAKES_ARG(CHAR) \
  39.   (   (CHAR) == 'D' \
  40.    || (CHAR) == 'U' \
  41.    || (CHAR) == 'o' \
  42.    || (CHAR) == 'e' \
  43.    || (CHAR) == 'T' \
  44.    || (CHAR) == 'u' \
  45.    || (CHAR) == 'I' \
  46.    || (CHAR) == 'm' \
  47.    || (CHAR) == 'L' \
  48.    || (CHAR) == 'A' \
  49.    || (CHAR) == 'h' \
  50.    || (CHAR) == 'z')
  51.  
  52. #define MASK_HALF_PIC         010000000000    /* Mask for half-pic code */
  53. #define MASK_HALF_PIC_DEBUG     004000000000    /* Debug flag */
  54. #define MASK_ELF        002000000000    /* ELF not rose */
  55. #define MASK_NO_IDENT        001000000000    /* suppress .ident */
  56. #define MASK_NO_UNDERSCORES    000400000000    /* suppress leading _ */
  57. #define MASK_LARGE_ALIGN    000200000000    /* align to >word boundaries */
  58. #define MASK_NO_MCOUNT        000100000000    /* profiling uses mcount_ptr */
  59.  
  60. #define TARGET_HALF_PIC        (target_flags & MASK_HALF_PIC)
  61. #define TARGET_DEBUG        (target_flags & MASK_HALF_PIC_DEBUG)
  62. #define HALF_PIC_DEBUG        TARGET_DEBUG
  63. #define TARGET_ELF        (target_flags & MASK_ELF)
  64. #define TARGET_ROSE        ((target_flags & MASK_ELF) == 0)
  65. #define TARGET_IDENT        ((target_flags & MASK_NO_IDENT) == 0)
  66. #define TARGET_UNDERSCORES    ((target_flags & MASK_NO_UNDERSCORES) == 0)
  67. #define TARGET_LARGE_ALIGN    (target_flags & MASK_LARGE_ALIGN)
  68. #define TARGET_MCOUNT        ((target_flags & MASK_NO_MCOUNT) == 0)
  69.  
  70. #undef    SUBTARGET_SWITCHES
  71. #define SUBTARGET_SWITCHES                        \
  72.      { "half-pic",         MASK_HALF_PIC},            \
  73.      { "no-half-pic",        -MASK_HALF_PIC},            \
  74.      { "debug-half-pic",     MASK_HALF_PIC_DEBUG},            \
  75.      { "debugb",         MASK_HALF_PIC_DEBUG},            \
  76.      { "elf",             MASK_ELF},                \
  77.      { "rose",            -MASK_ELF},                \
  78.      { "ident",            -MASK_NO_IDENT},            \
  79.      { "no-ident",         MASK_NO_IDENT},            \
  80.      { "underscores",        -MASK_NO_UNDERSCORES},            \
  81.      { "no-underscores",     MASK_NO_UNDERSCORES},            \
  82.      { "large-align",         MASK_LARGE_ALIGN},            \
  83.      { "no-large-align",    -MASK_LARGE_ALIGN},            \
  84.      { "mcount",        -MASK_NO_MCOUNT},            \
  85.      { "mcount-ptr",         MASK_NO_MCOUNT},            \
  86.      { "no-mcount",         MASK_NO_MCOUNT},
  87.  
  88. /* OSF/rose uses stabs, not dwarf.  */
  89. #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
  90.  
  91. #ifndef DWARF_DEBUGGING_INFO
  92. #define DWARF_DEBUGGING_INFO    /* enable dwarf debugging for testing */
  93. #endif
  94.  
  95. /* Handle #pragma weak and #pragma pack.  */
  96.  
  97. #define HANDLE_SYSV_PRAGMA
  98. #define SUPPORTS_WEAK    TARGET_ELF
  99.  
  100. /* Change default predefines.  */
  101. #undef    CPP_PREDEFINES
  102. #define CPP_PREDEFINES "-DOSF -DOSF1 -Dunix -Di386 -Asystem(unix) -Asystem(xpg4) -Acpu(i386) -Amachine(i386)"
  103.  
  104. #undef  CPP_SPEC
  105. #define CPP_SPEC "\
  106. %{!melf: -D__ROSE__ %{!pic-none: -D__SHARED__}} \
  107. %{melf: -D__ELF__ %{fpic: -D__SHARED__}} \
  108. %{mno-underscores: -D__NO_UNDERSCORES__} \
  109. %{melf: %{!munderscores: -D__NO_UNDERSCORES__}} \
  110. %{.S:    %{!ansi:%{!traditional:%{!traditional-cpp:%{!ftraditional: -traditional}}}}} \
  111. %{.S:    -D__LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \
  112. %{.cc:    -D__LANGUAGE_C_PLUS_PLUS} \
  113. %{.cxx:    -D__LANGUAGE_C_PLUS_PLUS} \
  114. %{.C:    -D__LANGUAGE_C_PLUS_PLUS} \
  115. %{.m:    -D__LANGUAGE_OBJECTIVE_C} \
  116. %{!.S:    -D__LANGUAGE_C %{!ansi:-DLANGUAGE_C}}"
  117.  
  118. /* Turn on -pic-extern by default for OSF/rose, -fpic for ELF.  */
  119. #undef  CC1_SPEC
  120. #define CC1_SPEC "\
  121. %{gline:%{!g:%{!g0:%{!g1:%{!g2: -g1}}}}} \
  122. %{!melf: %{!mrose: -mrose }} \
  123. %{melf: %{!munderscores: %{!mno-underscores: -mno-underscores }} \
  124.     %{!mmcount: %{!mno-mcount: %{!mmcount-ptr: -mmcount-ptr }}}} \
  125. %{!melf: %{!munderscores: %{!mno-underscores: -munderscores }} \
  126.      %{!mmcount: %{!mno-mcount: %{!mmcount-ptr: -mmcount }}} \
  127.      %{pic-extern: -mhalf-pic } %{pic-lib: -mhalf-pic } \
  128.      %{!pic-extern: %{!pic-lib: %{pic-none: -mno-half-pic} %{!pic-none: -mhalf-pic}}} \
  129.      %{pic-calls: } %{pic-names*: }}"
  130.  
  131. #undef    ASM_SPEC
  132. #define ASM_SPEC       "%{v*: -v}"
  133.  
  134. #undef  LINK_SPEC
  135. #define LINK_SPEC      "%{v*: -v} \
  136. %{!melf:    %{!noshrlib: %{pic-none: -noshrlib} %{!pic-none: -warn_nopic}} \
  137.         %{nostdlib} %{noshrlib} %{glue}} \
  138. %{melf:        %{dy} %{dn} %{glue: } \
  139.         %{h*} %{z*} \
  140.         %{static:-dn -Bstatic} \
  141.         %{shared:-G -dy} \
  142.         %{symbolic:-Bsymbolic -G -dy} \
  143.         %{G:-G} \
  144.         %{!dy: %{!dn: %{!static: %{!shared: %{!symbolic: \
  145.             %{noshrlib: -dn } %{pic-none: -dn } \
  146.             %{!noshrlib: %{!pic-none: -dy}}}}}}}}"
  147.  
  148. #undef  LIB_SPEC
  149. #define LIB_SPEC "-lc"
  150.  
  151. #undef  LIBG_SPEC
  152. #define LIBG_SPEC ""
  153.  
  154. #undef  STARTFILE_SPEC
  155. #define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}"
  156.  
  157. #undef TARGET_VERSION_INTERNAL
  158. #undef TARGET_VERSION
  159.  
  160. #define I386_VERSION " 80386, OSF/rose objects"
  161.  
  162. #define TARGET_VERSION_INTERNAL(STREAM) fputs (I386_VERSION, STREAM)
  163. #define TARGET_VERSION TARGET_VERSION_INTERNAL (stderr)
  164.  
  165. #undef  MD_EXEC_PREFIX
  166. #define MD_EXEC_PREFIX        "/usr/ccs/gcc/"
  167.  
  168. #undef  MD_STARTFILE_PREFIX
  169. #define MD_STARTFILE_PREFIX    "/usr/ccs/lib/"
  170.  
  171. /* Specify size_t, ptrdiff_t, and wchar_t types.  */
  172. #undef    SIZE_TYPE
  173. #undef    PTRDIFF_TYPE
  174. #undef    WCHAR_TYPE
  175. #undef    WCHAR_TYPE_SIZE
  176.  
  177. #define SIZE_TYPE    "long unsigned int"
  178. #define PTRDIFF_TYPE    "int"
  179. #define WCHAR_TYPE    "unsigned int"
  180. #define WCHAR_TYPE_SIZE BITS_PER_WORD
  181.  
  182. /* Define this macro if the system header files support C++ as well
  183.    as C.  This macro inhibits the usual method of using system header
  184.    files in C++, which is to pretend that the file's contents are
  185.    enclosed in `extern "C" {...}'. */
  186. #define NO_IMPLICIT_EXTERN_C
  187.  
  188. #ifdef NO_LONG_DOUBLE
  189. /* Turn off long double being 96 bits.  */
  190. #undef LONG_DOUBLE_TYPE_SIZE
  191. #define LONG_DOUBLE_TYPE_SIZE 64
  192. #endif
  193.  
  194. /* This macro generates the assembly code for function entry.
  195.    FILE is a stdio stream to output the code to.
  196.    SIZE is an int: how many units of temporary storage to allocate.
  197.    Refer to the array `regs_ever_live' to determine which registers
  198.    to save; `regs_ever_live[I]' is nonzero if register number I
  199.    is ever used in the function.  This macro is responsible for
  200.    knowing which registers should not be saved even if used.
  201.  
  202.    We override it here to allow for the new profiling code to go before
  203.    the prologue and the old mcount code to go after the prologue (and
  204.    after %ebx has been set up for ELF shared library support).  */
  205.  
  206. #define OSF_PROFILE_BEFORE_PROLOGUE                    \
  207.   (!TARGET_MCOUNT                            \
  208.    && !current_function_needs_context                    \
  209.    && (!flag_pic                            \
  210.        || !frame_pointer_needed                        \
  211.        || (!current_function_uses_pic_offset_table            \
  212.        && !current_function_uses_const_pool)))
  213.  
  214. #undef    FUNCTION_PROLOGUE
  215. #define FUNCTION_PROLOGUE(FILE, SIZE)                    \
  216. do                                    \
  217.   {                                    \
  218.     char *prefix = (TARGET_UNDERSCORES) ? "_" : "";            \
  219.     char *lprefix = LPREFIX;                        \
  220.     int labelno = profile_label_no;                    \
  221.                                     \
  222.     if (profile_flag && OSF_PROFILE_BEFORE_PROLOGUE)            \
  223.       {                                    \
  224.     if (!flag_pic && !HALF_PIC_P ())                \
  225.       {                                \
  226.         fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno);    \
  227.         fprintf (FILE, "\tcall *%s_mcount_ptr\n", prefix);        \
  228.       }                                \
  229.                                     \
  230.     else if (HALF_PIC_P ())                        \
  231.       {                                \
  232.         rtx symref;                            \
  233.                                     \
  234.         HALF_PIC_EXTERNAL ("_mcount_ptr");                \
  235.         symref = HALF_PIC_PTR (gen_rtx (SYMBOL_REF, Pmode,        \
  236.                         "_mcount_ptr"));        \
  237.                                     \
  238.         fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno);    \
  239.         fprintf (FILE, "\tmovl %s%s,%%eax\n", prefix,        \
  240.              XSTR (symref, 0));                    \
  241.         fprintf (FILE, "\tcall *(%%eax)\n");            \
  242.       }                                \
  243.                                     \
  244.     else                                \
  245.       {                                \
  246.         static int call_no = 0;                    \
  247.                                     \
  248.         fprintf (FILE, "\tcall %sPc%d\n", lprefix, call_no);    \
  249.         fprintf (FILE, "%sPc%d:\tpopl %%eax\n", lprefix, call_no);    \
  250.         fprintf (FILE, "\taddl $_GLOBAL_OFFSET_TABLE_+[.-%sPc%d],%%eax\n", \
  251.              lprefix, call_no++);                \
  252.         fprintf (FILE, "\tleal %sP%d@GOTOFF(%%eax),%%edx\n",    \
  253.              lprefix, labelno);                    \
  254.         fprintf (FILE, "\tmovl %s_mcount_ptr@GOT(%%eax),%%eax\n",    \
  255.              prefix);                        \
  256.         fprintf (FILE, "\tcall *(%%eax)\n");            \
  257.       }                                \
  258.       }                                    \
  259.                                     \
  260.     function_prologue (FILE, SIZE);                    \
  261.   }                                    \
  262. while (0)
  263.  
  264. /* A C statement or compound statement to output to FILE some assembler code to
  265.    call the profiling subroutine `mcount'.  Before calling, the assembler code
  266.    must load the address of a counter variable into a register where `mcount'
  267.    expects to find the address.  The name of this variable is `LP' followed by
  268.    the number LABELNO, so you would generate the name using `LP%d' in a
  269.    `fprintf'.
  270.  
  271.    The details of how the address should be passed to `mcount' are determined
  272.    by your operating system environment, not by GNU CC.  To figure them out,
  273.    compile a small program for profiling using the system's installed C
  274.    compiler and look at the assembler code that results. */
  275.  
  276. #undef  FUNCTION_PROFILER
  277. #define FUNCTION_PROFILER(FILE, LABELNO)                \
  278. do                                    \
  279.   {                                    \
  280.     if (!OSF_PROFILE_BEFORE_PROLOGUE)                    \
  281.       {                                    \
  282.     char *prefix = (TARGET_UNDERSCORES) ? "_" : "";            \
  283.     char *lprefix = LPREFIX;                    \
  284.     int labelno = LABELNO;                        \
  285.                                     \
  286.     /* Note that OSF/rose blew it in terms of calling mcount,    \
  287.        since OSF/rose prepends a leading underscore, but mcount's    \
  288.        doesn't.  At present, we keep this kludge for ELF as well    \
  289.        to allow old kernels to build profiling.  */            \
  290.                                     \
  291.     if (flag_pic                            \
  292.         && !current_function_uses_pic_offset_table            \
  293.         && !current_function_uses_const_pool)            \
  294.       abort ();                            \
  295.                                     \
  296.     if (TARGET_MCOUNT && flag_pic)                    \
  297.       {                                \
  298.         fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n",    \
  299.              lprefix, labelno);                    \
  300.         fprintf (FILE, "\tcall *%smcount@GOT(%%ebx)\n", prefix);    \
  301.       }                                \
  302.                                     \
  303.     else if (TARGET_MCOUNT && HALF_PIC_P ())            \
  304.       {                                \
  305.         rtx symdef;                            \
  306.                                     \
  307.         HALF_PIC_EXTERNAL ("mcount");                \
  308.         symdef = HALF_PIC_PTR (gen_rtx (SYMBOL_REF, Pmode, "mcount")); \
  309.         fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno);    \
  310.         fprintf (FILE, "\tcall *%s%s\n", prefix, XSTR (symdef, 0));    \
  311.       }                                \
  312.                                     \
  313.     else if (TARGET_MCOUNT)                        \
  314.       {                                \
  315.         fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno);    \
  316.         fprintf (FILE, "\tcall %smcount\n", prefix);        \
  317.       }                                \
  318.                                     \
  319.     else if (flag_pic && frame_pointer_needed)            \
  320.       {                                \
  321.         fprintf (FILE, "\tmovl 4(%%ebp),%%ecx\n");            \
  322.         fprintf (FILE, "\tpushl %%ecx\n");                \
  323.         fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n",    \
  324.              lprefix, labelno);                    \
  325.         fprintf (FILE, "\tmovl _mcount_ptr@GOT(%%ebx),%%eax\n");    \
  326.         fprintf (FILE, "\tcall *(%%eax)\n");            \
  327.         fprintf (FILE, "\tpopl %%eax\n");                \
  328.       }                                \
  329.                                     \
  330.     else if (frame_pointer_needed)                    \
  331.       {                                \
  332.         fprintf (FILE, "\tmovl 4(%%ebp),%%ecx\n");            \
  333.         fprintf (FILE, "\tpushl %%ecx\n");                \
  334.         fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno);    \
  335.         fprintf (FILE, "\tcall *_mcount_ptr\n");            \
  336.         fprintf (FILE, "\tpopl %%eax\n");                \
  337.       }                                \
  338.                                     \
  339.     else                                \
  340.       abort ();                            \
  341.       }                                    \
  342.   }                                    \
  343. while (0)
  344.  
  345. /* A C function or functions which are needed in the library to
  346.    support block profiling.  When support goes into libc, undo
  347.    the #if 0.  */
  348.  
  349. #if 0
  350. #undef    BLOCK_PROFILING_CODE
  351. #define    BLOCK_PROFILING_CODE
  352. #endif
  353.  
  354. /* Prefix for internally generated assembler labels.  If we aren't using
  355.    underscores, we are using prefix `.'s to identify labels that should
  356.    be ignored, as in `i386/gas.h' --karl@cs.umb.edu  */
  357. #undef    LPREFIX
  358. #define    LPREFIX ((TARGET_UNDERSCORES) ? "L" : ".L")
  359.  
  360. /* This is how to store into the string BUF
  361.    the symbol_ref name of an internal numbered label where
  362.    PREFIX is the class of label and NUM is the number within the class.
  363.    This is suitable for output with `assemble_name'.  */
  364.  
  365. #undef    ASM_GENERATE_INTERNAL_LABEL
  366. #define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER)            \
  367.     sprintf ((BUF), "*%s%s%d", (TARGET_UNDERSCORES) ? "" : ".",        \
  368.          (PREFIX), (NUMBER))
  369.  
  370. /* This is how to output an internal numbered label where
  371.    PREFIX is the class of label and NUM is the number within the class.  */
  372.  
  373. #undef    ASM_OUTPUT_INTERNAL_LABEL
  374. #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM)            \
  375.   fprintf (FILE, "%s%s%d:\n", (TARGET_UNDERSCORES) ? "" : ".",        \
  376.        PREFIX, NUM)
  377.  
  378. /* This is how to output a reference to a user-level label named NAME.  */
  379.  
  380. #undef    ASM_OUTPUT_LABELREF
  381. #define ASM_OUTPUT_LABELREF(FILE,NAME)                    \
  382.   fprintf (FILE, "%s%s", (TARGET_UNDERSCORES) ? "_" : "", NAME)
  383.  
  384. /* This is how to output an element of a case-vector that is relative.
  385.    This is only used for PIC code.  See comments by the `casesi' insn in
  386.    i386.md for an explanation of the expression this outputs. */
  387.  
  388. #undef ASM_OUTPUT_ADDR_DIFF_ELT
  389. #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
  390.   fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE)
  391.  
  392. /* Output a definition */
  393. #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2)                \
  394. do                                    \
  395. {                                    \
  396.     fprintf ((FILE), "\t%s\t", SET_ASM_OP);                \
  397.     assemble_name (FILE, LABEL1);                    \
  398.     fprintf (FILE, ",");                        \
  399.     assemble_name (FILE, LABEL2);                    \
  400.     fprintf (FILE, "\n");                        \
  401.     }                                    \
  402. while (0)
  403.  
  404. /* A C expression to output text to align the location counter in the
  405.    way that is desirable at a point in the code that is reached only
  406.    by jumping.
  407.  
  408.    This macro need not be defined if you don't want any special
  409.    alignment to be done at such a time.  Most machine descriptions do
  410.    not currently define the macro.  */
  411.  
  412. #undef    ASM_OUTPUT_ALIGN_CODE
  413. #define ASM_OUTPUT_ALIGN_CODE(STREAM)                    \
  414.   fprintf (STREAM, "\t.align\t%d\n",                    \
  415.        (!TARGET_LARGE_ALIGN && i386_align_jumps > 2) ? 2 : i386_align_jumps)
  416.  
  417. /* A C expression to output text to align the location counter in the
  418.    way that is desirable at the beginning of a loop.
  419.  
  420.    This macro need not be defined if you don't want any special
  421.    alignment to be done at such a time.  Most machine descriptions do
  422.    not currently define the macro.  */
  423.  
  424. #undef    ASM_OUTPUT_LOOP_ALIGN
  425. #define ASM_OUTPUT_LOOP_ALIGN(STREAM) \
  426.   fprintf (STREAM, "\t.align\t%d\n", i386_align_loops)
  427.  
  428. /* A C statement to output to the stdio stream STREAM an assembler
  429.    command to advance the location counter to a multiple of 2 to the
  430.    POWER bytes.  POWER will be a C expression of type `int'.  */
  431.  
  432. #undef    ASM_OUTPUT_ALIGN
  433. #define ASM_OUTPUT_ALIGN(STREAM, POWER)                    \
  434.   fprintf (STREAM, "\t.align\t%d\n",                    \
  435.        (!TARGET_LARGE_ALIGN && (POWER) > 2) ? 2 : (POWER))
  436.  
  437. /* A C expression that is 1 if the RTX X is a constant which is a
  438.    valid address.  On most machines, this can be defined as
  439.    `CONSTANT_P (X)', but a few machines are more restrictive in
  440.    which constant addresses are supported.
  441.  
  442.    `CONSTANT_P' accepts integer-values expressions whose values are
  443.    not explicitly known, such as `symbol_ref', `label_ref', and
  444.    `high' expressions and `const' arithmetic expressions, in
  445.    addition to `const_int' and `const_double' expressions.  */
  446.  
  447. #define CONSTANT_ADDRESS_P_ORIG(X)                    \
  448.   (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF        \
  449.    || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST        \
  450.    || GET_CODE (X) == HIGH)
  451.  
  452. #undef    CONSTANT_ADDRESS_P
  453. #define CONSTANT_ADDRESS_P(X)                                           \
  454.   ((CONSTANT_ADDRESS_P_ORIG (X)) && (!HALF_PIC_P () || !HALF_PIC_ADDRESS_P (X)))
  455.  
  456. /* Nonzero if the constant value X is a legitimate general operand.
  457.    It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE.  */
  458.  
  459. #undef    LEGITIMATE_CONSTANT_P
  460. #define LEGITIMATE_CONSTANT_P(X)                    \
  461.   (!HALF_PIC_P ()                            \
  462.    || GET_CODE (X) == CONST_DOUBLE                    \
  463.    || GET_CODE (X) == CONST_INT                        \
  464.    || !HALF_PIC_ADDRESS_P (X))
  465.  
  466. /* Sometimes certain combinations of command options do not make sense
  467.    on a particular target machine.  You can define a macro
  468.    `OVERRIDE_OPTIONS' to take account of this.  This macro, if
  469.    defined, is executed once just after all the command options have
  470.    been parsed.  */
  471.  
  472. #undef  SUBTARGET_OVERRIDE_OPTIONS
  473. #define SUBTARGET_OVERRIDE_OPTIONS                    \
  474. {                                    \
  475.   /*                                    \
  476.   if (TARGET_ELF && TARGET_HALF_PIC)                    \
  477.     {                                    \
  478.       target_flags &= ~MASK_HALF_PIC;                    \
  479.       flag_pic = 1;                            \
  480.     }                                    \
  481.   */                                    \
  482.                                     \
  483.   if (TARGET_ROSE && flag_pic)                        \
  484.     {                                    \
  485.       target_flags |= MASK_HALF_PIC;                    \
  486.       flag_pic = 0;                            \
  487.     }                                    \
  488.                                     \
  489.   if (TARGET_HALF_PIC)                            \
  490.     half_pic_init ();                            \
  491. }
  492.  
  493. /* Define this macro if references to a symbol must be treated
  494.    differently depending on something about the variable or
  495.    function named by the symbol (such as what section it is in).
  496.  
  497.    The macro definition, if any, is executed immediately after the
  498.    rtl for DECL has been created and stored in `DECL_RTL (DECL)'.
  499.    The value of the rtl will be a `mem' whose address is a
  500.    `symbol_ref'.
  501.  
  502.    The usual thing for this macro to do is to a flag in the
  503.    `symbol_ref' (such as `SYMBOL_REF_FLAG') or to store a modified
  504.    name string in the `symbol_ref' (if one bit is not enough
  505.    information).
  506.  
  507.    The best way to modify the name string is by adding text to the
  508.    beginning, with suitable punctuation to prevent any ambiguity.
  509.    Allocate the new name in `saveable_obstack'.  You will have to
  510.    modify `ASM_OUTPUT_LABELREF' to remove and decode the added text
  511.    and output the name accordingly.
  512.  
  513.    You can also check the information stored in the `symbol_ref' in
  514.    the definition of `GO_IF_LEGITIMATE_ADDRESS' or
  515.    `PRINT_OPERAND_ADDRESS'. */
  516.  
  517. #undef    ENCODE_SECTION_INFO
  518. #define ENCODE_SECTION_INFO(DECL)                    \
  519. do                                    \
  520.   {                                    \
  521.    if (HALF_PIC_P ())                            \
  522.       HALF_PIC_ENCODE (DECL);                        \
  523.                                     \
  524.    else if (flag_pic)                            \
  525.      {                                    \
  526.        rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd'        \
  527.           ? TREE_CST_RTL (DECL) : DECL_RTL (DECL));        \
  528.        SYMBOL_REF_FLAG (XEXP (rtl, 0))                    \
  529.      = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd'            \
  530.         || ! TREE_PUBLIC (DECL));                    \
  531.       }                                    \
  532.   }                                    \
  533. while (0)
  534.  
  535.  
  536. /* On most machines, read-only variables, constants, and jump tables
  537.    are placed in the text section.  If this is not the case on your
  538.    machine, this macro should be defined to be the name of a function
  539.    (either `data_section' or a function defined in `EXTRA_SECTIONS')
  540.    that switches to the section to be used for read-only items.
  541.  
  542.    If these items should be placed in the text section, this macro
  543.    should not be defined.  */
  544.  
  545. #if 0
  546. #undef    READONLY_DATA_SECTION
  547. #define READONLY_DATA_SECTION()                        \
  548. do                                    \
  549.   {                                    \
  550.     if (TARGET_ELF)                            \
  551.       {                                    \
  552.     if (in_section != in_rodata)                    \
  553.       {                                \
  554.         fprintf (asm_out_file, "\t.section \"rodata\"\n");        \
  555.         in_section = in_rodata;                    \
  556.       }                                \
  557.       }                                    \
  558.     else                                \
  559.       text_section ();                            \
  560.   }                                    \
  561. while (0)
  562. #endif
  563.  
  564. /* A list of names for sections other than the standard two, which are
  565.    `in_text' and `in_data'.  You need not define this macro on a
  566.    system with no other sections (that GCC needs to use).  */
  567.  
  568. #undef    EXTRA_SECTIONS
  569. #define    EXTRA_SECTIONS in_rodata, in_data1
  570.  
  571. /* Given a decl node or constant node, choose the section to output it in
  572.    and select that section.  */
  573.  
  574. #undef    SELECT_RTX_SECTION
  575. #define SELECT_RTX_SECTION(MODE, RTX)                    \
  576. do                                    \
  577.   {                                    \
  578.     if (MODE == Pmode && HALF_PIC_P () && HALF_PIC_ADDRESS_P (RTX))    \
  579.       data_section ();                            \
  580.     else                                \
  581.       readonly_data_section ();                        \
  582.   }                                    \
  583. while (0)
  584.  
  585. #undef    SELECT_SECTION
  586. #define SELECT_SECTION(DECL, RELOC)                    \
  587. {                                    \
  588.   if (RELOC && HALF_PIC_P ())                        \
  589.     data_section ();                            \
  590.                                     \
  591.   else if (TREE_CODE (DECL) == STRING_CST)                \
  592.     {                                    \
  593.       if (flag_writable_strings)                    \
  594.     data_section ();                        \
  595.       else                                \
  596.     readonly_data_section ();                    \
  597.     }                                    \
  598.                                     \
  599.   else if (TREE_CODE (DECL) != VAR_DECL)                \
  600.     readonly_data_section ();                        \
  601.                                     \
  602.   else if (!TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL)        \
  603.        || !DECL_INITIAL (DECL)                    \
  604.        || (DECL_INITIAL (DECL) != error_mark_node            \
  605.            && !TREE_CONSTANT (DECL_INITIAL (DECL))))        \
  606.     data_section ();                            \
  607.                                     \
  608.   else                                    \
  609.     readonly_data_section ();                        \
  610. }
  611.  
  612.  
  613. /* Define the strings used for the special svr4 .type and .size directives.
  614.    These strings generally do not vary from one system running svr4 to
  615.    another, but if a given system (e.g. m88k running svr) needs to use
  616.    different pseudo-op names for these, they may be overridden in the
  617.    file which includes this one.  */
  618.  
  619. #define TYPE_ASM_OP    ".type"
  620. #define SIZE_ASM_OP    ".size"
  621. #define SET_ASM_OP    ".set"
  622.  
  623. /* This is how we tell the assembler that a symbol is weak.  */
  624.  
  625. #define ASM_WEAKEN_LABEL(FILE,NAME) \
  626.   do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
  627.        fputc ('\n', FILE); } while (0)
  628.  
  629. /* The following macro defines the format used to output the second
  630.    operand of the .type assembler directive.  Different svr4 assemblers
  631.    expect various different forms for this operand.  The one given here
  632.    is just a default.  You may need to override it in your machine-
  633.    specific tm.h file (depending upon the particulars of your assembler).  */
  634.  
  635. #define TYPE_OPERAND_FMT    "@%s"
  636.  
  637. /* A C statement (sans semicolon) to output to the stdio stream
  638.    STREAM any text necessary for declaring the name NAME of an
  639.    initialized variable which is being defined.  This macro must
  640.    output the label definition (perhaps using `ASM_OUTPUT_LABEL').
  641.    The argument DECL is the `VAR_DECL' tree node representing the
  642.    variable.
  643.  
  644.    If this macro is not defined, then the variable name is defined
  645.    in the usual manner as a label (by means of `ASM_OUTPUT_LABEL').  */
  646.  
  647. #undef    ASM_DECLARE_OBJECT_NAME
  648. #define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL)                 \
  649. do                                         \
  650.  {                                         \
  651.    ASM_OUTPUT_LABEL(STREAM,NAME);                         \
  652.    HALF_PIC_DECLARE (NAME);                             \
  653.    if (TARGET_ELF)                                 \
  654.      {                                         \
  655.        fprintf (STREAM, "\t%s\t ", TYPE_ASM_OP);                 \
  656.        assemble_name (STREAM, NAME);                         \
  657.        putc (',', STREAM);                             \
  658.        fprintf (STREAM, TYPE_OPERAND_FMT, "object");                 \
  659.        putc ('\n', STREAM);                             \
  660.        size_directive_output = 0;                         \
  661.        if (!flag_inhibit_size_directive && DECL_SIZE (DECL))             \
  662.      {                                     \
  663.            size_directive_output = 1;                         \
  664.        fprintf (STREAM, "\t%s\t ", SIZE_ASM_OP);                 \
  665.        assemble_name (STREAM, NAME);                     \
  666.        fprintf (STREAM, ",%d\n",  int_size_in_bytes (TREE_TYPE (DECL))); \
  667.      }                                     \
  668.      }                                         \
  669.  }                                         \
  670. while (0)
  671.  
  672. /* Output the size directive for a decl in rest_of_decl_compilation
  673.    in the case where we did not do so before the initializer.
  674.    Once we find the error_mark_node, we know that the value of
  675.    size_directive_output was set
  676.    by ASM_DECLARE_OBJECT_NAME when it was run for the same decl.  */
  677.  
  678. #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END)     \
  679. do {                                     \
  680.      char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0);             \
  681.      if (TARGET_ELF                             \
  682.      && !flag_inhibit_size_directive && DECL_SIZE (DECL)         \
  683.          && ! AT_END && TOP_LEVEL                     \
  684.      && DECL_INITIAL (DECL) == error_mark_node             \
  685.      && !size_directive_output)                     \
  686.        {                                 \
  687.      fprintf (FILE, "\t%s\t ", SIZE_ASM_OP);             \
  688.      assemble_name (FILE, name);                     \
  689.      fprintf (FILE, ",%d\n",  int_size_in_bytes (TREE_TYPE (DECL))); \
  690.        }                                 \
  691.    } while (0)
  692.  
  693. /* This is how to declare a function name. */
  694.  
  695. #undef    ASM_DECLARE_FUNCTION_NAME
  696. #define ASM_DECLARE_FUNCTION_NAME(STREAM,NAME,DECL)            \
  697. do                                    \
  698.  {                                    \
  699.    ASM_OUTPUT_LABEL(STREAM,NAME);                    \
  700.    HALF_PIC_DECLARE (NAME);                        \
  701.    if (TARGET_ELF)                            \
  702.      {                                    \
  703.        fprintf (STREAM, "\t%s\t ", TYPE_ASM_OP);            \
  704.        assemble_name (STREAM, NAME);                    \
  705.        putc (',', STREAM);                        \
  706.        fprintf (STREAM, TYPE_OPERAND_FMT, "function");            \
  707.        putc ('\n', STREAM);                        \
  708.        ASM_DECLARE_RESULT (STREAM, DECL_RESULT (DECL));            \
  709.      }                                    \
  710.  }                                    \
  711. while (0)
  712.  
  713. /* Write the extra assembler code needed to declare a function's result.
  714.    Most svr4 assemblers don't require any special declaration of the
  715.    result value, but there are exceptions.  */
  716.  
  717. #ifndef ASM_DECLARE_RESULT
  718. #define ASM_DECLARE_RESULT(FILE, RESULT)
  719. #endif
  720.  
  721. /* This is how to declare the size of a function.  */
  722.  
  723. #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL)            \
  724. do                                    \
  725.   {                                    \
  726.     if (TARGET_ELF && !flag_inhibit_size_directive)            \
  727.       {                                    \
  728.         char label[256];                        \
  729.     static int labelno;                        \
  730.     labelno++;                            \
  731.     ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno);        \
  732.     ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno);        \
  733.     fprintf (FILE, "\t%s\t ", SIZE_ASM_OP);                \
  734.     assemble_name (FILE, (FNAME));                    \
  735.         fprintf (FILE, ",");                        \
  736.     assemble_name (FILE, label);                    \
  737.         fprintf (FILE, "-");                        \
  738.     assemble_name (FILE, (FNAME));                    \
  739.     putc ('\n', FILE);                        \
  740.       }                                    \
  741.   }                                    \
  742. while (0)
  743.  
  744. /* Attach a special .ident directive to the end of the file to identify
  745.    the version of GCC which compiled this code.  The format of the
  746.    .ident string is patterned after the ones produced by native svr4
  747.    C compilers.  */
  748.  
  749. #define IDENT_ASM_OP ".ident"
  750.  
  751. /* Allow #sccs in preprocessor.  */
  752.  
  753. #define SCCS_DIRECTIVE
  754.  
  755. /* This says what to print at the end of the assembly file */
  756. #define ASM_FILE_END(STREAM)                        \
  757. do                                    \
  758.   {                                    \
  759.     if (HALF_PIC_P ())                            \
  760.       HALF_PIC_FINISH (STREAM);                        \
  761.                                     \
  762.     if (TARGET_IDENT)                            \
  763.       {                                    \
  764.     char *fstart = main_input_filename;                \
  765.     char *fname;                            \
  766.                                     \
  767.     if (!fstart)                            \
  768.       fstart = "<no file>";                        \
  769.                                     \
  770.     fname = fstart + strlen (fstart) - 1;                \
  771.     while (fname > fstart && *fname != '/')                \
  772.       fname--;                            \
  773.                                     \
  774.     if (*fname == '/')                        \
  775.       fname++;                            \
  776.                                     \
  777.     fprintf ((STREAM), "\t%s\t\"GCC: (GNU) %s %s -O%d",        \
  778.          IDENT_ASM_OP, version_string, fname, optimize);    \
  779.                                     \
  780.     if (write_symbols == PREFERRED_DEBUGGING_TYPE)            \
  781.       fprintf ((STREAM), " -g%d", (int)debug_info_level);        \
  782.                                     \
  783.     else if (write_symbols == DBX_DEBUG)                \
  784.       fprintf ((STREAM), " -gstabs%d", (int)debug_info_level);    \
  785.                                     \
  786.     else if (write_symbols == DWARF_DEBUG)                \
  787.       fprintf ((STREAM), " -gdwarf%d", (int)debug_info_level);    \
  788.                                     \
  789.     else if (write_symbols != NO_DEBUG)                \
  790.       fprintf ((STREAM), " -g??%d", (int)debug_info_level);        \
  791.                                     \
  792.     if (flag_omit_frame_pointer)                    \
  793.       fprintf ((STREAM), " -fomit-frame-pointer");            \
  794.                                     \
  795.     if (flag_strength_reduce)                    \
  796.       fprintf ((STREAM), " -fstrength-reduce");            \
  797.                                     \
  798.     if (flag_unroll_loops)                        \
  799.       fprintf ((STREAM), " -funroll-loops");            \
  800.                                     \
  801.     if (flag_schedule_insns)                    \
  802.       fprintf ((STREAM), " -fschedule-insns");            \
  803.                                     \
  804.     if (flag_schedule_insns_after_reload)                \
  805.       fprintf ((STREAM), " -fschedule-insns2");            \
  806.                                     \
  807.     if (flag_force_mem)                        \
  808.       fprintf ((STREAM), " -fforce-mem");                \
  809.                                     \
  810.     if (flag_force_addr)                        \
  811.       fprintf ((STREAM), " -fforce-addr");                \
  812.                                     \
  813.     if (flag_inline_functions)                    \
  814.       fprintf ((STREAM), " -finline-functions");            \
  815.                                     \
  816.     if (flag_caller_saves)                        \
  817.       fprintf ((STREAM), " -fcaller-saves");            \
  818.                                     \
  819.     if (flag_pic)                            \
  820.       fprintf ((STREAM), (flag_pic > 1) ? " -fPIC" : " -fpic");    \
  821.                                     \
  822.     if (flag_inhibit_size_directive)                \
  823.       fprintf ((STREAM), " -finhibit-size-directive");        \
  824.                                     \
  825.     if (flag_gnu_linker)                        \
  826.       fprintf ((STREAM), " -fgnu-linker");                \
  827.                                     \
  828.     if (profile_flag)                        \
  829.       fprintf ((STREAM), " -p");                    \
  830.                                     \
  831.     if (profile_block_flag)                        \
  832.       fprintf ((STREAM), " -a");                    \
  833.                                     \
  834.     if (TARGET_IEEE_FP)                        \
  835.       fprintf ((STREAM), " -mieee-fp");                \
  836.                                     \
  837.     if (TARGET_HALF_PIC)                        \
  838.       fprintf ((STREAM), " -mhalf-pic");                \
  839.                                     \
  840.     if (!TARGET_MOVE)                        \
  841.       fprintf ((STREAM), " -mno-move");                \
  842.                                     \
  843.     if (TARGET_386)                            \
  844.       fprintf ((STREAM), " -m386");                    \
  845.                                     \
  846.     else if (TARGET_486)                        \
  847.       fprintf ((STREAM), " -m486");                    \
  848.                                     \
  849.     else                                \
  850.       fprintf ((STREAM), " -munknown-machine");            \
  851.                                     \
  852.     fprintf ((STREAM), (TARGET_ELF) ? " -melf\"\n" : " -mrose\"\n"); \
  853.       }                                    \
  854.   }                                    \
  855. while (0)
  856.  
  857. /* Tell collect that the object format is OSF/rose.  */
  858. #define OBJECT_FORMAT_ROSE
  859.  
  860. /* Tell collect where the appropriate binaries are.  */
  861. #define REAL_NM_FILE_NAME    "/usr/ccs/gcc/bfd-nm"
  862. #define REAL_STRIP_FILE_NAME    "/usr/ccs/bin/strip"
  863.  
  864. /* Use atexit for static constructors/destructors, instead of defining
  865.    our own exit function.  */
  866. #define HAVE_ATEXIT
  867.  
  868. /* Define this macro meaning that gcc should find the library 'libgcc.a'
  869.    by hand, rather than passing the argument '-lgcc' to tell the linker
  870.    to do the search */
  871. #define LINK_LIBGCC_SPECIAL
  872.  
  873. /* A C statement to output assembler commands which will identify the object
  874.   file as having been compile with GNU CC. We don't need or want this for
  875.   OSF1. GDB doesn't need it and kdb doesn't like it */
  876. #define ASM_IDENTIFY_GCC(FILE)
  877.  
  878. /* Identify the front-end which produced this file.  To keep symbol
  879.    space down, and not confuse kdb, only do this if the language is
  880.    not C.  */
  881.  
  882. #define ASM_IDENTIFY_LANGUAGE(STREAM)                    \
  883. {                                    \
  884.   if (strcmp (lang_identify (), "c") != 0)                \
  885.     output_lang_identify (STREAM);                    \
  886. }
  887.  
  888. /* Generate calls to memcpy, etc., not bcopy, etc. */
  889. #define TARGET_MEM_FUNCTIONS
  890.  
  891. /* Don't default to pcc-struct-return, because gcc is the only compiler, and
  892.    we want to retain compatibility with older gcc versions.  */
  893. #define DEFAULT_PCC_STRUCT_RETURN 0
  894.  
  895. /* Map i386 registers to the numbers dwarf expects.  Of course this is different
  896.    from what stabs expects.  */
  897.  
  898. #define DWARF_DBX_REGISTER_NUMBER(n) \
  899. ((n) == 0 ? 0 \
  900.  : (n) == 1 ? 2 \
  901.  : (n) == 2 ? 1 \
  902.  : (n) == 3 ? 3 \
  903.  : (n) == 4 ? 6 \
  904.  : (n) == 5 ? 7 \
  905.  : (n) == 6 ? 5 \
  906.  : (n) == 7 ? 4 \
  907.  : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n)+3 \
  908.  : (-1))
  909.  
  910. /* Now what stabs expects in the register.  */
  911. #define STABS_DBX_REGISTER_NUMBER(n) \
  912. ((n) == 0 ? 0 : \
  913.  (n) == 1 ? 2 : \
  914.  (n) == 2 ? 1 : \
  915.  (n) == 3 ? 3 : \
  916.  (n) == 4 ? 6 : \
  917.  (n) == 5 ? 7 : \
  918.  (n) == 6 ? 4 : \
  919.  (n) == 7 ? 5 : \
  920.  (n) + 4)
  921.  
  922. #undef    DBX_REGISTER_NUMBER
  923. #define DBX_REGISTER_NUMBER(n) ((write_symbols == DWARF_DEBUG)        \
  924.                 ? DWARF_DBX_REGISTER_NUMBER(n)        \
  925.                 : STABS_DBX_REGISTER_NUMBER(n))
  926.